package com.oocl.mqThread;

import java.io.IOException;

import javax.jms.JMSException;
import javax.jms.Session;
import javax.jms.TextMessage;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.oocl.DAOImpl.BooksDAOImpl;
import com.oocl.booksAche.BooksAche;

import POJO.Books;

public class MqThread extends Thread{
	private Books book;
	private Object obj;
	
	public MqThread(Books book,Object obj){
		this.book = book;
		this.obj = obj;
	}
	
	
	
	@Override
	public void run() {
			
		synchronized (obj) {
			BooksAche.getAche().add(book);
			if(BooksAche.getAche().size()==500){
				new BooksDAOImpl().addBooks(BooksAche.getAche());
				
			}
		}
	
	}
}
